package com.gistmap.sideline.exception;

import lombok.Getter;

/**
 * @author zhangran
 * @date 2018/12/19
 */
@Getter
public class ServiceException extends RuntimeException {
    private int code;
    private String message;
    private Integer errorCode;

    public ServiceException(int errorCode, String message) {
        this.code = 400;
        this.message = message;
        this.errorCode = errorCode;
    }

    public ServiceException( String message) {
        this.code = 400;
        this.message = message;
        this.errorCode = 400;
    }

    public ServiceException(int errorCode, String message, int code) {
        this.code = code;
        this.message = message;
        this.errorCode = errorCode;
    }

    public ServiceException(String message, int code) {
        this.code = code;
        this.message = message;
    }

    public ServiceException(ErrorItems errorItems) {
        this.code = errorItems.getCode();
        this.message = errorItems.getMessage();
    }
}